/**
 * 卡库存迁移
 */
function getCardStock(){
	var issuecompanyno= $V('issuecompanyno');
    if($isNull(issuecompanyno)){
        alert('请填写发卡商号!');
        return;
    }
	$.ajax({
		type : "POST",
		url : ctxRoot + '/datamigrateservlet.do?method=getEntityCardListInsertCardStock',
		cache : false,
		data : {
			issuecompanyno : issuecompanyno
		},
		success : function(data) {
			alert('卡库存迁移开始!');
            return;
		}
	});
}

/**
 * 卡库存迁移明细
 */
function getCardDetail(){
	var cardFaceId= $V('cardFaceId');
    if($isNull(cardFaceId)){
        alert('请填写卡面样id!');
        return;
    }
    var operId= $V('operId');
    if($isNull(operId)){
        alert('请填写操作员id!');
        return;
    }
	$.ajax({
		type : "POST",
		url : ctxRoot + '/datamigrateservlet.do?method=insertIssueCardStockDetail',
		cache : false,
		data : {
			cardFaceId : cardFaceId,
			operId : operId
		},
		success : function(data) {
			alert('卡库存迁移明细开始!');
            return;
		}
	});
}

//发卡机构迁移
function getIssueBranch(){
    var issuecompanyno= $V('issuecompanyno');
    if($isNull(issuecompanyno)){
        alert('请填写发卡商号!');
        return;
    }
    var regionNo= $V('regionNo');
    if($isNull(regionNo)){
        alert('请填写区域码!');
        return;
    }
    if(regionNo.length!=6){
        alert('请填写区级区域码!');
        return;
    }
    $.ajax({
		type : "POST",
		url : ctxRoot + '/datamigrateservlet.do?method=getIssueBranch',
		cache : false,
		data : {
		    issuecompanyno : issuecompanyno,
			regionNo : regionNo
		},
		success : function(data) {
			alert(data);
            return;
		}
	});
}
//销售机构迁移
function getSaleBranch(){
    var issuecompanyno= $V('issuecompanyno');
    if($isNull(issuecompanyno)){
        alert('请填写发卡商号!');
        return;
    }
    var regionNo= $V('regionNo');
    if($isNull(regionNo)){
        alert('请填写区域码!');
        return;
    }
    if(regionNo.length!=6){
        alert('请填写区级区域码!');
        return;
    }
    var incomeBranchId= $V('incomeBranchId');
    if($isNull(incomeBranchId)){
        alert('请填写收益机构id!');
        return;
    }
    var issuebranchno= $V('issuebranchno');
    if($isNull(issuebranchno)){
        alert('请填写发卡机构号!');
        return;
    }
    $.ajax({
		type : "POST",
		url : ctxRoot + '/datamigrateservlet.do?method=getSaleBranch',
		cache : false,
		data : {
		   issuecompanyno : issuecompanyno,
		   incomeBranchId : incomeBranchId,
		   issuebranchno : issuebranchno,
		   regionNo : regionNo
		},
		success : function(data) {
			alert(data);
            return;
		}
	});
}
//用户迁移
function getUser(){
    var issuecompanyno= $V('issuecompanyno');
    if($isNull(issuecompanyno)){
        alert('请填写发卡商号!');
        return;
    }
    var roleid= $V('roleid');
    if($isNull(roleid)){
        alert('请填写角色id!');
        return;
    }
    var issuebranchno= $V('issuebranchno');
    if($isNull(issuebranchno)){
        alert('请填写发卡机构号!');
        return;
    }
    $.ajax({
		type : "POST",
		url : ctxRoot + '/datamigrateservlet.do?method=getUser',
		cache : false,
		data : {
		   issuecompanyno : issuecompanyno,
		   roleid : roleid,
		   issuebranchno : issuebranchno
		},
		success : function(data) {
			alert(data);
            return;
		}
	});
}
//商户迁移
function getMerchant(){
    var issuecompanyno= $V('issuecompanyno');
    if($isNull(issuecompanyno)){
        alert('请填写发卡商号!');
        return;
    }
    var issuebranchno= $V('issuebranchno');
    if($isNull(issuebranchno)){
        alert('请填写发卡机构号!');
        return;
    }
    var incomeBranchId= $V('incomeBranchId');
    if($isNull(incomeBranchId)){
        alert('请填写收益机构id!');
        return;
    }
     var regionNo= $V('regionNo');
    if($isNull(regionNo)){
        alert('请填写区域码!');
        return;
    }
    if(regionNo.length!=4){
        alert('请填写市级区域码!');
        return;
    }
 
   $.ajax({
		type : "POST",
		url : ctxRoot + '/datamigrateservlet.do?method=getMerchant',
		cache : false,
		data : {
		   issuecompanyno : issuecompanyno,
		   incomeBranchId : incomeBranchId,
		   regionNo : regionNo,
		   issuebranchno : issuebranchno
		},
		success : function(data) {
			alert(data);
            return;
		}
	});
}
//卡种类迁移
function getCardClass(){
    var issuecompanyno= $V('issuecompanyno');
    if($isNull(issuecompanyno)){
        alert('请填写发卡商号!');
        return;
    }    
    $.ajax({
		type : "POST",
		url : ctxRoot + '/datamigrateservlet.do?method=getCardClass',
		cache : false,
		data : {
		   issuecompanyno : issuecompanyno
		},
		success : function(data) {
			alert(data);
            return;
		}
	});
}
//卡控制迁移
function getMakeCard(){
    var issuecompanyno= $V('issuecompanyno');
    if($isNull(issuecompanyno)){
        alert('请填写发卡商号!');
        return;
    } 
    var cardManufactureId= $V('cardManufactureId');
    if($isNull(cardManufactureId)){
        alert('请填写制卡商id!');
        return;
    } 
    var cardFaceId= $V('cardFaceId');
    if($isNull(cardFaceId)){
        alert('请填写卡面样id!');
        return;
    }    
    $.ajax({
		type : "POST",
		url : ctxRoot + '/datamigrateservlet.do?method=getMakeCard',
		cache : false,
		data : {
		   issuecompanyno : issuecompanyno,
		   cardManufactureId : cardManufactureId,
		   cardFaceId : cardFaceId
		},
		success : function(data) {
			alert(data);
            return;
		}
	});
}

function getPMBSHisTradDetail(){
    $.ajax({
		type : "POST",
		url : ctxRoot + '/datamigrateservlet.do?method=getPMBSHisTradDetail',
		cache : false,
		data : '',
		success : function(data) {
			alert(data);
            return;
		}
	});
}
function getPMBSTradSummary(){
	alert("开始迁移");
    $.ajax({
		type : "POST",
		url : ctxRoot + '/datamigrateservlet.do?method=getPMBSTradSummary',
		cache : false,
		data : '',
		success : function(data) {
			alert(data);
            return;
		}
	});
}

function getPMBSSortInfo(){
	var issuecompanyno= $V('issuecompanyno');
    if($isNull(issuecompanyno)){
        alert('请填写发卡商号!');
        return;
    }
	alert("开始迁移");
    $.ajax({
		type : "POST",
		url : ctxRoot + '/datamigrateservlet.do?method=getPMBSSortInfo',
		cache : false,
		data : {issuecompanyno:issuecompanyno},
		success : function(data) {
			alert(data);
            return;
		}
	});
}
function getPMBSSortInfoGoOn(){
	var issuecompanyno= $V('issuecompanyno');
    if($isNull(issuecompanyno)){
        alert('请填写发卡商号!');
        return;
    }
	alert("开始迁移");
    $.ajax({
		type : "POST",
		url : ctxRoot + '/datamigrateservlet.do?method=getPMBSSortInfoGoOn',
		cache : false,
		data : {issuecompanyno:issuecompanyno},
		success : function(data) {
			alert(data);
            return;
		}
	});
}

function deleteMapTradDetail(){
	alert("删除MAP");
    $.ajax({
		type : "POST",
		url : ctxRoot + '/datamigrateservlet.do?method=deleteMapTradDetail',
		cache : false,
		data : '',
		success : function(data) {
			alert(data);
            return;
		}
	});
}
function getPMBSDataByTranDate(){
	var issuecompanyno= $V('issuecompanyno');
    if($isNull(issuecompanyno)){
        alert('请填写发卡商号!');
        return;
    }
	var ip= $V('ip');
	var port= $V('port');
	var trandate= $V('trandate');
    if($isNull(ip)){
        alert('请填写IP!');
        return;
    }
    if($isNull(port)){
        alert('请填写port!');
        return;
    }
    if($isNull(trandate)){
        alert('请填写trandate!');
        return;
    }
    var oldMerchantNo=$V('oldMerchantNo');
    var a = document.getElementsByName("radios"); 
    var tag=0;
	for(i=0;i<a.length;i++) 
	{ 
		if(a[i].checked){ 
			tag=a[i].value; 
		}
	}
    alert("开始并行PMBS数据");
	$.ajax({
		type : "POST",
		url : ctxRoot + '/datamigrateservlet.do?method=getPMBSDataByTranDate',
		cache : false,
		data : {
			issuecompanyno:issuecompanyno,ip : ip,port:port,trandate:trandate,oldMerchantNo:oldMerchantNo,tag:tag
		},
		success : function(data) {
			alert(data);
            return;
		}
	});
}
function getPIBSDataByTranDate(){
	var ip= $V('ip');
	var port= $V('port');
	var trandate= $V('trandate');
    if($isNull(ip)){
        alert('请填写IP!');
        return;
    }
    if($isNull(port)){
        alert('请填写port!');
        return;
    }
    if($isNull(trandate)){
        alert('请填写trandate!');
        return;
    }
    
    var MerchantNo= $V('MerchantNo');
	var factMerchantNo= $V('factMerchantNo');
	var webMerchantNo= $V('webMerchantNo');
    if($isNull(MerchantNo)){
        alert('请填写便民驿站商户号!');
        return;
    }
    if($isNull(factMerchantNo)){
        alert('请填写便民驿站实体店商户分支机构号!');
        return;
    }
    if($isNull(webMerchantNo)){
        alert('请填写便民驿站网站商户分支机构号!');
        return;
    }
    
    alert("开始并行PIBS交易数据");
	$.ajax({
		type : "POST",
		url : ctxRoot + '/datamigrateservlet.do?method=getPIBSDataByTranDate',
		cache : false,
		data : {
			ip : ip,port:port,trandate:trandate,MerchantNo:MerchantNo,factMerchantNo:factMerchantNo,webMerchantNo:webMerchantNo
		},
		success : function(data) {
			alert(data);
            return;
		}
	});
}
//自动售卡
function saleOldCard(){
	var issuecompanyno= $V('issuecompanyno');
	var trandate= $V('trandate');
	var enddate= $V('enddate');
    if($isNull(issuecompanyno)){
        alert('请填写issuecompanyno!');
        return;
    }
    if($isNull(trandate)){
        alert('请填写trandate!');
        return;
    }
    if($isNull(enddate)){
        alert('请填写enddate!');
        return;
    }
    
    var operId= $V('operId');
	var cardFaceId= $V('cardFaceId');
    if($isNull(operId)){
        alert('请填写operId!');
        return;
    }
    if($isNull(cardFaceId)){
        alert('请填写cardFaceId!');
        return;
    }
    alert("开始自动售卡");
	$.ajax({
		type : "POST",
		url : ctxRoot + '/datamigrateservlet.do?method=saleOldCard',
		cache : false,
		data : {
			issuecompanyno : issuecompanyno,trandate:trandate,enddate:enddate,operId:operId,cardFaceId:cardFaceId
		},
		success : function(data) {
			alert(data);
            return;
		}
	});
}
//激活卡迁移
function tranferActivateCard(){
	var issuecompanyno= $V('issuecompanyno');
    if($isNull(issuecompanyno)){
        alert('请填写发卡商号!');
        return;
    }
    var threadcnt = $V('threadcnt');
	$.ajax({
		type : "POST",
		url : ctxRoot + '/datamigrateservlet.do?method=tranferActivateCard',
		cache : false,
		data : {
				issuecompanyno : issuecompanyno,
				threadcnt : threadcnt
		},
		success : function(data) {
			alert(data);
            return;
		}
	});
}

